using System;
using System.Xml;
using System.Xml.Serialization;
using rlTodayMakeSkin.Project.Attributes;
using System.Windows.Forms;

namespace rlTodayMakeSkin.Project.XmlElement
{
    /// <summary>
    /// represents a Image xml element in the skin.xml file
    /// </summary>
    public class rlImage : rlTodayXmlElement
    {
        private string source;

        public rlImage(XmlAttributeCollection attr, rlTodayProject p)
            : base(attr, p)
        {
            strNome = "Image";
            if (attr["source"] != null) source = attr["source"].Value;
            if (source == "")
            {
                source = "ImageBig.png";
            }
        }

        public rlImage(rlTodayProject p)
            : base(p)
        {
            strNome = "Image";
            source = "ImageBig.png";
        }

        /// <summary>
        /// for the serialization
        /// </summary>
        public rlImage() { }

        /// <summary>
        /// Gets, sets the filename of the image
        /// </summary>
        [XmlAttribute("source")]
        [PropertyDescription("File name of the image", PropertyTypes.FILE_IMAGE)]
        public string Source
        {
            get { return source; }
            set { source = value; }
        }

        public override void DrawElement(System.Drawing.Graphics g)
        {
            DrawImage(g, source);
        }


    }
}
